import { userApi } from '@/network'

export function login (username, password) {
  return new Promise((resolve, reject) => {
    userApi.login({
      username: username,
      pwd: password
    })
    .then(res => res.data)
    .then(res => {
      resolve(res)
    }).catch(err => {
      reject(err)
    })
  })
}
export function refresh (token) {
  return new Promise((resolve, reject) => {
    userApi.refresh(token)
      .then(res => res.data)
      .then(res => {
        resolve(res)
      }).catch(err => {
        reject(err)
      })
  })
}